package com.hxl.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hxl.entity.CmfzBanner;
import com.hxl.mapper.CmfzBannerMapper;
import com.hxl.service.CmfzBannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * InnoDB free: 10240 kB 服务实现类
 * </p>
 *
 * @author hxl
 * @since 2020-08-18
 */
@Service
public class CmfzBannerServiceImpl extends ServiceImpl<CmfzBannerMapper, CmfzBanner> implements CmfzBannerService {
    @Autowired
    private CmfzBannerMapper cmfzBannerMapper;
    @Override
    public Page<CmfzBanner> selectBanner(Integer page, Integer limit) {
        Page<CmfzBanner> cmfzBannerPage = new Page<>(page, limit);

        Page<CmfzBanner> pages = (Page<CmfzBanner>) cmfzBannerMapper.selectPage(cmfzBannerPage, null);

        return pages;
    }

    @Override
    public void deleteById(Integer id) {
        cmfzBannerMapper.deleteById(id);
    }

    @Override
    public void addBanner(CmfzBanner banner) {
        cmfzBannerMapper.insert(banner);
    }

    @Override
    public void updateBanner(CmfzBanner banner) {
        cmfzBannerMapper.updateById(banner);
    }
}
